﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace LFSRecord2.View.Converters
{
    public class PropertyBindingIconImageConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool isActive = (bool)value;
            BitmapImage kwImage = new BitmapImage();

            kwImage.BeginInit();
            if (isActive)
            {
                kwImage.UriSource = new Uri("pack://application:,,,/data/bitmaps/icons/PropertyBindingIconOn.png");
            }
            else
            {
                kwImage.UriSource = new Uri("pack://application:,,,/data/bitmaps/icons/PropertyBindingIconOff.png");
            }
            kwImage.EndInit();
            return kwImage;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
